package com.jlcindia;

public class OopsTest30 {
	public static void main(String[] args) {
		Hello30 h=new Hello30();
		System.out.println(h);
		Hello30 h2=new Hello30();
		System.out.println(h2);
		OopsTest30 test=new OopsTest30();
		System.out.println(test);
		System.out.println(new Hello30());
		System.out.println("\n===");
		Hello30 h3=new Hello30(){
		};//OopsTest30$1.class
		System.out.println(h3);
		Hello30 h4=new Hello30(){
		};//OopsTest30$2.class
		System.out.println(h4);
		//System.out.println(new Hello(){}==new Hello(){});
		System.out.println(new Hello30()==new Hello30());
		//System.out.println(new Ah()==new Bh());
		System.out.println(new Hello30(){}instanceof Hello30);
		System.out.println("\n**********");
		Ah ref=new Ah();
		ref.show();
		Bh ref2=new Bh();
		ref2.show();
		Hello30 h5=new Hello30(){};
		h5.show();
		new Hello30().show();
		new Hello30(){}.show();
		new Hello30(){
			int XY=8787;
			void display(){
				System.out.println("\n Display in Anonymous class:"+this);
				System.out.println("XY:"+XY);
			}
		}.display();
		Hello30 h6=new Hello30(){
			int XY=8787;
			void display(){
				System.out.println("\n Display in Anonymous class:"+this);
				System.out.println("XY:"+XY);
			}};
			h6.show();//new object of anonymous class created
			System.out.println(h6.msg);
			//no display();
			//System.out.println(h6.XY);
	}}

	
class Hello30{
	String msg="Hello MSG";
	void show(){
		System.out.println("**show() of Hello class:"+this);
	}
}
class Ah extends Hello30{
	void process(){}
}
class Bh extends Hello30{}